package cn.com.nroad.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;

/**
 *@author jia
 */
@Entity
@Data
@AllArgsConstructor
@Table(name = "evidence",
        uniqueConstraints = {
                @UniqueConstraint(name = "fk_evidence_path", columnNames = "path")},
        indexes = {
                @Index(name = "idx_evidence_id",columnList = "id")})
public class Evidence {

    /**
     * 编号
     */
    @Id
    @Column(length = 32)
    @GeneratedValue(generator = "idGenerator")
    @GenericGenerator(name = "idGenerator", strategy = "uuid")
    private String id;

    /**
     * 文件名
     */
    @Column(length = 100)
    private String name;

    /**
     * 路径
     */
    @Column(length = 200)
    private String path;

    /**
     * 工号
     */
    @Column(length = 32)
    private String jobNumber;


    /**
     * 类型
     */
    @Column(length = 10)
    private String type;

    /**
     * 大小
     */
    private long length;

    /**
     * 创建时间
     */
    private Date createDate;

    public Evidence(){
        this.createDate = new Date();
    }
}
